package com.yiyi.credit.manage.abutment.common.enums;

public enum TdReturnCodeEnum {

    CODE0000("0000","处理成功"),
    CODE9901("9901","系统繁忙，请稍后再试"),
    CODE9902("9902","系统维护中，请稍后再试"),
    CODE9999("9999","系统错误");

    private final String code;
    private final String value;

    TdReturnCodeEnum(String code, String value)
    {
        this.code = code;
        this.value = value;
    }

    public String getCode()
    {
        return code;
    }

    public String getValue()
    {
        return value;
    }

    public static boolean isCode(String code)
    {
        for (TdReturnCodeEnum s : TdReturnCodeEnum.values())
        {
            if (s.getCode().equals(code))
            {
                return true;
            }
        }
        return false;
    }
    /**
     * 根据编码获取信息
     * @param code
     * @return
     */
    public static String getValueByCode(String code)
    {
        for (TdReturnCodeEnum v : TdReturnCodeEnum.values())
        {
            if (v.getCode().equals(code))
            {
                return v.getValue();
            }
        }
        return null;
    }
}
